var mongoose = require('mongoose');

//资源共享表(resource)

var resourceSchema = new mongoose.Schema({
    resourcename: {
        type: String,
        required: true
    }, //资源共享标题
    resourceimg: {
        type: String
    }, //资源共享主图
    content: {
        type: String,
        required: true
    }, //富文本内容
    userid: {
        type: mongoose.SchemaTypes.ObjectId,
        ref: 'user_login',
        required: true
    }, //用户id
    textReplace: {
        type: String
    }, //文章缩略
    enclosure: {
        type: String
    }, //附件
    lookenclosure: {
        type: String
    }, //附件显示名
    filesName: {
        type: String
    }, //资源文件名
    release_time: {
        type: Date,
        default: new Date
    }, //发布时间
    aeticletype: {
        type: String,
        required: true
    }, //文章类型
    classify: {
        type: String
    }, //资源类型
    audit: {
        type: Boolean,
        default: false
    },
    reading: {
        type: Number,
        default: 0
    }, //阅读量
    reply: {
        type: Number,
        default: 0
    }, //回复量
    praise: {
        type: Array,
        default: []
    }, //赞量
    praiseSize: {
        type: Number,
        default: 0
    }, //赞量
})

module.exports = mongoose.model('resource', resourceSchema)